package com.xunsiya.common.config.util;

import org.assertj.core.util.Lists;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author shengwm
 * @version V0.0.1
 * @Title: TreeNode
 * @Package com.topvision.common.tree
 * @Description: 树形节点
 * @date 2017/4/18 13:59
 */
public class TreeNode<T> implements StandardTree<T>, Serializable {

    private String id;
    private String text;
    private String parentId;
    private String resolution;
    private T data;
    boolean selected = false;
    private Integer sort;

    private boolean isLeaf;

    List<TreeNode<T>> children = new ArrayList<TreeNode<T>>();
    @Override
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
    @Override
    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }
    @Override
    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }
    @Override
    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public boolean isSelected() {
        return selected;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    public List<TreeNode<T>> getChildren() {
        return children;
    }

    public void setChildren(List<TreeNode<T>> children) {
        this.children = children;
    }
    @Override
    public Integer getSort() {
        return sort;
    }

    public boolean isLeaf() {
        return children.size() == 0;
    }

    public void setLeaf(boolean leaf) {
        isLeaf = leaf;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }
    @Override
    public String getResolution() {
        return resolution;
    }

    public void setResolution(String resolution) {
        this.resolution = resolution;
    }
}
